package cobersky.skinUI.components
{
	import cobersky.skinUI.core.Component;
	import cobersky.skinUI.skins.bar.DefaultVBarSkin;
	import cobersky.skinUI.skins.core.IBarSkin;
	
	import flash.display.DisplayObject;
	import flash.events.MouseEvent;
	import flash.geom.Rectangle;
	
	public class VBar extends BarBase
	{
		public function VBar(){
			dragRect=new Rectangle(0,0,0,100);
		}
		override public function create():void{
			if(!_skinClass)_skinClass=DefaultVBarSkin;
			attachSkin();
		}
		override public function set height(value:Number):void
		{
			_back.height=value;
			dragRect.height=value-_thumb.height;
		}
		override protected function onMove(event:MouseEvent):void
		{
			value=_thumb.y/(_back.height-_thumb.height);
			super.onMove(event);
		}
		override protected function moveThumb():void
		{
			_thumb.y=value*(_back.height-_thumb.height);
			super.moveThumb();
		}
		
		override protected function backClick():void
		{
			value=(mouseY-_thumb.height*.5)/(_back.height-_thumb.height);
			super.backClick();
		}
	}
}